BTTask = {}

local this = BTTask

function this:New()
	local o = {}
	setmetatable(o, self)
	self.__index = self
	o.executionStatus = BTTaskStatus.Inactive   --该节点的执行状态
	o.root = nil            					 --根节点
	o.parent = nil          					 --父节点
	o.layer = 1                                 --第几层
	o.index = 1                                 --父节点下的第几个节点
	o.name = "BTTask"                           --该节点名字
	return o
end

function this:ToString()
	local root = "root:"
	if (self.root) then
		root = root .. self.root.name
	else
		root = root .. "nil"
	end

	local parent = "parent:"
	if (self.parent) then
		parent = parent .. self.parent.name
	else
		parent = parent .. "nil"
	end

	local layer = "layer:" .. self.layer
	local index = "index:" .. self.index
	local name = "name:" .. self.name
	local executionStatus="executionStatus:" .. self.executionStatus

	if (self.layer == 1) then
		name = "root:" .. self.name
		return name .. "\n" .. layer .. "\n" .. index .. "\n" .. executionStatus .. "\n------------------------"
	end
	return name .. "\n" .. layer .. "\n" .. parent .. "\n" .. index .. "\n" .. root .. "\n" .. executionStatus .. "\n------------------------"
end